Skip to content

Omit unauthenticated error response bodies - #1693

Open
whoalin1 wants to merge 1 commit into
sabre-io:masterfrom
whoalin1:devin/1795990800-auth-error-body
Open

whoalin1 wants to merge 1 commit into
sabre-io:masterfrom
whoalin1:devin/1795990800-auth-error-body

Conversation

@whoalin1

Copy link
Copy Markdown

Fixes #1639.

An unauthenticated response currently exposes the framework version, exception class, and detailed authentication failure reasons even though RFC 4918 does not require an XML error body for a 401 response. This change omits the body for NotAuthenticated unless debugExceptions is enabled; authentication challenge headers are preserved.

Validation:

  • ServerSimpleTest passed: 24 tests, 67 assertions, including regression coverage for debug and non-debug 401 responses.
  • Full tests/Sabre/DAV suite passed: 656 tests, 1268 assertions, 38 skipped.
  • PHP syntax checks passed.
  • PHPStan reported no errors for the changed files.

Not run: php-cs-fixer, because the installed Symfony Console dependency uses syntax unsupported by the available PHP 8.3 runtime before the fixer starts; manual live WebDAV client validation was not run.

Assisted-by: Devin:adaptive

A 401 response can expose the application framework, version, exception class and internal authentication failure details without helping a client authenticate. Since RFC 4918 does not require an XML error body for 401 responses, omit it unless debug exception output is enabled.

Assisted-by: Devin:adaptive
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not expose implementation details on unauthenticated access

1 participant